package com.bdth.bdthiss.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.bdth.bdthiss.entity.Customer;
import com.bdth.bdthiss.entity.Seller;
import com.bdth.bdthiss.service.SellerService;
import com.bdth.bdthiss.vo.PageVo;
import com.bdth.bdthiss.vo.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * <p>
 * 商家表 前端控制器
 * </p>
 *
 * @author LGP
 * @since 2019-08-21
 */
@Controller
@RequestMapping("/seller")
public class SellerController {
    @Autowired
    private SellerService sellerService;

    @RequestMapping(value = "index")
    public String index() {
        return "seller/index";
    }

    @RequestMapping(value = "list")
    @ResponseBody
    public PageVo<Seller> getPageList(Pagination<Customer> pagination, @RequestParam(required = false) String trueName, @RequestParam(required = false) String mobile){
        Page<Seller> items = sellerService.listPages(pagination, trueName, mobile);
        PageVo<Seller> pageVo = new PageVo<>(items.getRecords(),items.getTotal());
        return pageVo;
    }

    @RequestMapping(value = "search")
    public String search() {
        return "seller/search";
    }
}

